diff --git a/kernel/Makefile b/kernel/Makefile
index dc5c775..1c0de13 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -20,6 +20,8 @@ endif
 # cond_syscall is currently not LTO compatible
 CFLAGS_sys_ni.o = $(DISABLE_LTO)
 
+CFLAGS_smp.o := -DDEBUG
+
 obj-y += sched/
 obj-y += locking/
 obj-y += power/
diff --git a/kernel/smp.c b/kernel/smp.c
index aff8aa1..7b94c6a 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -14,6 +14,8 @@
 #include <linux/smp.h>
 #include <linux/cpu.h>
 
+#include <linux/sched.h> //for schedule()
+#include <asm/delay.h>  //for udelay(..)
 #include "smpboot.h"
 
 enum {
@@ -548,6 +550,7 @@ void __weak smp_announce(void)
 void __init smp_init(void)
 {
 	unsigned int cpu;
+	unsigned long timeout;
 
 	idle_threads_init();
 
@@ -555,8 +558,21 @@ void __init smp_init(void)
 	for_each_present_cpu(cpu) {
 		if (num_online_cpus() >= setup_max_cpus)
 			break;
-		if (!cpu_online(cpu))
-			cpu_up(cpu);
+		if (!cpu_online(cpu)) {
+      /*pr_debug("waiting 5 seconds before trying cpu_up");
+      for (timeout = 0; timeout < 50000; timeout++) {
+        udelay(100);
+        schedule();
+      }
+      pr_debug("done waiting, trying cpu_up:");*/
+      pr_debug("trying cpu_up:");
+			if (cpu_up(cpu)) {
+        //do it one more time:
+        pr_debug("doing it one more time: cpu_up !!!!!!!!!!!!");
+        cpu_up(cpu);
+      }
+      pr_debug("after cpu_up !!!!!!!!!!!!");
+    }
 	}
 
 	/* Any cleanup work */
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index ada2e2d..c65c267 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -18,6 +18,9 @@ endif
 
 CFLAGS_irq.o := -I$(src)/../include/asm/trace
 
+#https://www.kernel.org/doc/local/pr_debug.txt
+CFLAGS_smpboot.o := -DDEBUG
+
 obj-y			:= process_$(BITS).o signal.o entry_$(BITS).o
 obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
 obj-y			+= time.o ioport.o ldt.o dumpstack.o nmi.o
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 2d872e0..853bcbe 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -144,10 +144,11 @@ static void smp_callin(void)
 	 * by a factor of two. This should be enough.
 	 */
 
+  pr_debug("Waiting max 15 sec for callout\n");
 	/*
 	 * Waiting 2s total for startup (udelay is not yet working)
 	 */
-	timeout = jiffies + 2*HZ;
+	timeout = jiffies + 15*HZ;
 	while (time_before(jiffies, timeout)) {
 		/*
 		 * Has the boot CPU finished it's STARTUP sequence?
@@ -156,6 +157,7 @@ static void smp_callin(void)
 			break;
 		cpu_relax();
 	}
+  pr_debug("done waiting max 15 sec for callout\n");
 
 	if (!time_before(jiffies, timeout)) {
 		panic("%s: CPU%d started up but did not get a callout!\n",
@@ -520,6 +522,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 {
 	unsigned long send_status, accept_status = 0;
 	int maxlvt, num_starts, j;
+  unsigned long timeout;
 
 	maxlvt = lapic_get_maxlvt();
 
@@ -532,6 +535,15 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 		apic_read(APIC_ESR);
 	}
 
+
+/*  pr_debug("waiting 5 sec before INIT");
+  for (timeout = 0; timeout < 50000; timeout++) {                               
+  //moving mouse here DOES NOT cause Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting");
+*/
 	pr_debug("Asserting INIT\n");
 
 	/*
@@ -542,24 +554,83 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 	 */
 	apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT,
 		       phys_apicid);
-
-	pr_debug("Waiting for send to finish...\n");
+//FROM HERE:[  if you move mouse....
+
+//moo
+/*  pr_debug("waiting 5 sec");
+  for (timeout = 0; timeout < 50000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting");
+*/
+	pr_debug("Waiting for INIT send to finish...\n");
 	send_status = safe_apic_wait_icr_idle();
 
 	mdelay(10);
 
+	pr_debug("status for above ^ is: %lu\n", send_status);
+
+//moo
+/*  pr_debug("waiting 5 sec");
+  for (timeout = 0; timeout < 50000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting");
+*/
 	pr_debug("Deasserting INIT\n");
 
 	/* Target chip */
 	/* Send IPI */
 	apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid);
 
-	pr_debug("Waiting for send to finish...\n");
+//moo
+/*  pr_debug("waiting 5 sec");
+  for (timeout = 0; timeout < 50000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting");
+*/
+	pr_debug("Waiting for above send to finish...\n");
 	send_status = safe_apic_wait_icr_idle();
 
+/*
+//moo
+  pr_debug("waiting 3 sec");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting");
+*/
 	mb();
-	atomic_set(&init_deasserted, 1);
 
+//moo
+/*  pr_debug("waiting 3 sec");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting");
+*/
+	atomic_set(&init_deasserted, 1);
+/*
+//moo
+  pr_debug("waiting 3 sec\n");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting\n");
+*/
 	/*
 	 * Should we send STARTUP IPIs ?
 	 *
@@ -571,6 +642,16 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 	else
 		num_starts = 0;
 
+//moo
+/*  pr_debug("waiting 3 sec\n");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting\n");
+*/
+
 	/*
 	 * Paravirt / VMI wants a startup IPI hook here to set up the
 	 * target processor state.
@@ -578,6 +659,16 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 	startup_ipi_hook(phys_apicid, (unsigned long) start_secondary,
 			 stack_start);
 
+
+//moo
+/*  pr_debug("waiting 3 sec\n");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //moving mouse here causes Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting\n");
+*/
 	/*
 	 * Run STARTUP IPI loop.
 	 */
@@ -589,17 +680,36 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 			apic_write(APIC_ESR, 0);
 		apic_read(APIC_ESR);
 		pr_debug("After apic_write\n");
+//moo
+/*  pr_debug("waiting 3 sec\n");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //this causes Not responding only when j=1 and moving mouse during this interval only (that is, start moving when the interval started and stop moving it before the interval is over)
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting\n");
+*/
 
 		/*
 		 * STARTUP IPI
 		 */
 
+//UNTIL HERE:]  if you move mouse.... it will cause CPU to never wake up until cold/warm boot!
 		/* Target chip */
 		/* Boot on the stack */
 		/* Kick the second */
 		apic_icr_write(APIC_DM_STARTUP | (start_eip >> 12),
 			       phys_apicid);
 
+/*  pr_debug("after icr_write, waiting 3 sec\n");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //this doesn't cause Not responding regardless of j value
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting\n");
+*/
+
 		/*
 		 * Give the other CPU some time to accept the IPI.
 		 */
@@ -622,11 +732,22 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 	}
 	pr_debug("After Startup\n");
 
+
+
 	if (send_status)
 		pr_err("APIC never delivered???\n");
 	if (accept_status)
 		pr_err("APIC delivery error (%lx)\n", accept_status);
 
+//moo
+/*  pr_debug("waiting 3 sec\n");
+  for (timeout = 0; timeout < 30000; timeout++) {                               
+    //moving mouse here DOES NOT cause Not responding
+    udelay(100);
+    //schedule();
+  }
+  pr_debug("done waiting\n");
+*/
 	return (send_status | accept_status);
 }
 
@@ -747,6 +868,7 @@ out:
  */
 static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
 {
+
 	volatile u32 *trampoline_status =
 		(volatile u32 *) __va(real_mode_header->trampoline_status);
 	/* start_ip had better be page-aligned! */
@@ -824,6 +946,8 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
 		/*
 		 * Wait 5s total for a response
 		 */
+//moo2
+    pr_debug("start waiting 5sec for response");
 		for (timeout = 0; timeout < 50000; timeout++) {
 			if (cpumask_test_cpu(cpu, cpu_callin_mask))
 				break;	/* It has booted */
@@ -836,6 +960,10 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
 			 */
 			schedule();
 		}
+    pr_debug("done waiting 5sec for response");
+		pr_debug("cpumask_test_cpu result: %d", cpumask_test_cpu(cpu, cpu_callin_mask));
+		pr_debug("cpu_callin_mask: %016lx", cpumask_bits(cpu_callin_mask)[0]);
+		pr_debug("cpu_callout_mask: %016lx", cpumask_bits(cpu_callout_mask)[0] );
 
 		if (cpumask_test_cpu(cpu, cpu_callin_mask)) {
 			print_cpu_msr(&cpu_data(cpu));
@@ -888,6 +1016,7 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
 	int apicid = apic->cpu_present_to_apicid(cpu);
 	unsigned long flags;
 	int err;
+//  unsigned long timeout;
 
 	WARN_ON(irqs_disabled());
 
@@ -919,9 +1048,17 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
 	/* the FPU context is blank, nobody can own it */
 	__cpu_disable_lazy_restore(cpu);
 
+  //redo:
+  /*pr_debug("before calling do_boot_cpu: waiting 5 sec before continuing");
+  for (timeout = 0; timeout < 50000; timeout++) {
+    udelay(100);
+    schedule();
+  }*/
 	err = do_boot_cpu(apicid, cpu, tidle);
 	if (err) {
 		pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu);
+    //pr_err("retrying forever!");
+    //goto redo;
 		return -EIO;
 	}
 
